home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Resource Library: Multimedia
/
Resource Library: Multimedia.iso
/
hypertxt
/
msdos
/
hydos10
/
if
< prev
next >
Wrap
Text File
|
1991-04-14
|
1KB
|
39 lines
IF
Performs conditional execution of commands in batch files.
If the condition is met then the command will be executed. If the
condition is not met then the command will be ignored. If the NOT
parameter is entered, the command is executed when the condition is
false.
COMMAND TYPE: Internal (batch) VERSION: 2.0 and up
USE: IF [NOT] condition command
"command" is the DOS command or program to be executed when the condition is
met. "condition" can be one of the following:
errorlevel number
or string1 == string2
or EXIST filename
errorlevel number, where number is the exit code of the previously
executed program.
Some possible errorlevel numbers are:
0 = Normal completion 1 = No files found
3 = Terminated by CTRL-BREAK or ESCAPE 4 = Terminated because of error
Some programs may return other errorlevel codes than these. The
errorlevel number condition will be true if the last program executed
has an exit code equal to or greater than the number specified.
string1 == string2 is true if string1 and string2 are exactly
identical after %variable substitution. The strings may not contain
separators (,;= or spaces) To test for a null %variable, use IF
"%var"==""
EXIST filename is true if the specified file exists. A drive and path
may be specified.
EXAMPLE: IF NOT EXIST DATA.FIL ECHO Cannot find data file